<template>
    <div class="screenAG-rankingBoard-wrapper">
        <dv-scroll-ranking-board v-if="!reset"  :config="optionRanking"  />
    </div>
</template>
<script>
export default {
  name: "blockCenter",
  mixins: [],
  components: {},
  data() {
    return {
        chartData:{
          legend:['企业A长企业名称长企业名称AA','企业B','企业C','企业D','企业E','企业F','企业G'],
          data:[235, 210, 187, 212, 278, 220, 320,],
        },
        reset:false,
        optionRanking:{
          data: [
            // { name: '企业2A长企业名称长企业名称', value: 32 }, 
            // { name: '企业2B', value: 28 }, 
            // { name: '企业2C', value: 24 }, 
            // { name: '企业2D', value: 19 }, 
            // { name: '企业2E', value: 16 }, 
            // { name: '企业2F', value: 17 }, 
            // { name: '企业2G', value: 5 }
          ],
          rowNum:3,
          //carousel: 'page'
          waitTime:5000
        },
    };
  },
  props: ['tabActive'],
  watch:{
    tabActive(val){
      this.reset=true
      let processData=[];
      let tempData=A("rd",{
        min:1,
        max:999,
        length:7,
        group:1
      })[0]
      tempData.forEach(item=>{
        processData.push(item);
      })
      this.chartData.data=processData;
      this.createData()
    }
  },
  computed: {},
  methods: {
    createData(){
      this.optionRanking.data=[]
      let {legend,data}=this.chartData;
      legend.forEach((item,i)=>{
        this.optionRanking.data.push({
          name:item+A("rs",3),
          value:data[i]
        })
      })
      A("tis",'rankingBoardScrollInit',()=>{
        this.reset=false
      },300)
    },
    
  },
  mounted() {
    this.createData();
    // if(this.tabActive>0){
    //   this.optionRanking.data=this.dataGroup[this.tabActive]
    // }else{
    //   this.optionRanking.data=this.dataGroup[0]
    // }
  },
  beforeDestroy(){
   
  },
  destroyed(){
  },
  
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="less">
.screenAG-rankingBoard-wrapper { height: 100%; padding:40px 20px 20px 20px; position: relative;
  .title{.fc(@cbl3);  text-align: left; font-size: 56px; position: absolute; left:0; right:0; top:15px; padding:0 0 0 15px; }
  .dv-scroll-ranking-board{width: 100%;height: 100%;
    .row-item{
      .ranking-info{
        .rank{}
        .info-name{}
        .ranking-value{}
      }
    }
  }
}

</style>
